<div class="row animated" ng-class="{true: 'fadeInRight', false:'fadeInLeft'}[currentAnimated]">
  <div class="col-xs-12 col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
        <a ng-click="discard()" href="javascript:;"><i class="backBtn fa fa-arrow-circle-left"></i></a>
        <span class="panelTitle" ng-bind="Form.title"></span>
      </div>
      <div class="panel-body">
        <form novalidate role="form" name="couponForm" class="form-horizontal">
          <div class="form-group" ng-class="{'has-error': couponForm.provideTitle.$invalid && couponForm.provideTitle.$dirty}">
            <label class="col-xs-3 col-md-2 control-label">活动名称：</label>
            <div class="col-xs-7 col-md-8">
              <input type="text" name="provideTitle" class="form-control" placeholder="活动名称" ng-model="coupon.provideTitle" required>
            </div>
            <div class="col-xs-2 col-md-2" ng-show="couponForm.provideTitle.$dirty && couponForm.provideTitle.$invalid">
              <span class="text-danger" ng-show="couponForm.provideTitle.$error.required">请输入活动名称</span>
            </div>
          </div>
          <div class="form-group">
            <label class="col-xs-3 col-md-2 control-label">活动描述：</label>
            <div class="col-xs-7 col-md-8">
              <input type="text" name="desc" class="form-control" placeholder="活动描述" ng-model="coupon.desc">
            </div>
          </div>
          <div class="form-group" ng-class="{'has-error': couponForm.content.$invalid && couponForm.content.$dirty}">
            <label class="control-label col-xs-3 col-md-2">活动规则：</label>
            <div class="col-xs-7 col-md-8">
              <textarea name="content" placeholder="活动规则" id="editor" bind-model="coupon.content" ng-bind-html="coupon.content | trustHtml" keditor data-config="options" required ng-model="coupon.contentBody">
              </textarea>
              <autosave module="coupon" saveId="{{coupon.id}}" interval="30000"></autosave>
            </div>
          </div>
          <div class="form-group" ng-class="{'has-error': couponForm.type.$invalid && couponForm.type.$dirty}">
            <label class="col-xs-3 col-md-2 control-label">优惠券类型：</label>
            <div class="col-xs-7 col-md-8">
              <select class="form-control w25c" name="type" required ng-model="coupon.type">
                <option value="0">现金券</option>
                <option value="1">折扣券</option>
              </select>
            </div>
          </div>
          <div class="form-group" ng-class="{'has-error': couponForm.type.$invalid && couponForm.type.$dirty}" ng-if="coupon.type == '1'">
            <label class="col-xs-3 col-md-2 control-label">折扣额度：</label>
            <div class="col-xs-7 col-md-8">
              <input type="text" name="payValue" class="form-control w25c" placeholder="折扣额度" ng-model="coupon.payValue" required>（如：录入0.8为8折优惠）
            </div>
          </div>
          <div class="form-group" ng-class="{'has-error': couponForm.payValue.$invalid && couponForm.payValue.$dirty}" ng-if="coupon.type == '0'">
            <label class="col-xs-3 col-md-2 control-label">发行面值：</label>
            <div class="col-xs-7 col-md-8">
              <input type="text" name="payValue" class="form-control w25c" placeholder="发行面值" ng-model="coupon.payValue" required>
            </div>
          </div>
          <div class="form-group" ng-class="{'has-error': couponForm.provideTotal.$invalid && couponForm.provideTotal.$dirty}">
            <label class="col-xs-3 col-md-2 control-label">发行份数：</label>
            <div class="col-xs-7 col-md-8">
              <input type="text" name="provideTotal" class="form-control w25c" placeholder="发行份数" ng-model="coupon.provideTotal" required>
            </div>
          </div>
          <div class="form-group" ng-class="{'has-error': couponForm.provideId.$invalid && couponForm.provideId.$dirty}">
            <label class="col-xs-3 col-md-2 control-label">发行方：</label>
            <div class="col-xs-7 col-md-8">
              <input type="text" name="provideId" class="form-control w25c" placeholder="发行方" ng-model="coupon.provideId"><span>(发行方ID，官方设置为0)</span>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-3 col-md-2">是否公开：</label>
            <div class="col-xs-7 col-md-8">
              <input type="radio" class="form-control" value="true" name="isPublic" icheck ng-model="coupon.isPublic">公开&nbsp;&nbsp;
              <input type="radio" class="form-control" value="false" name="isPublic" icheck ng-model="coupon.isPublic">私有
            </div>
          </div>
          <div class="col-xs-offset-2 col-md-offset-2 col-xs-offset-10 col-md-offset-10">
            <button class="btn btn-primary" type="submit" ng-click="submitForm()" ng-disabled="couponForm.$invalid">保存</button>
            <button class="btn btn-white" ng-click="discard()">取消</button>
          </div>
        </form>
      </div>
    </div>    
  </div>
</div>
<script src="libs/kindeditor/kindeditor.js" type="text/javascript"></script>
<script src="libs/kindeditor/lang/zh-CN.js" type="text/javascript"></script>